<?php
    require_once('../code/global.php');
    require_once('/code/SiteInfo.php');
    require_once('/code/News.php');
    $siteInfo=new SiteInfo();
    $s=$siteInfo->getSiteInfo();
    $news=new News();
    $n=$news->getNews();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="<?php echo $s['meta_keyword'] ?>" />  
        <meta name="keyword" content="<?php echo $s['meta_description'] ?>" />
        <title>News | <?php echo $s['site_name'] ?></title>
        <link rel="shortcut icon" href="/styles/images/icon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="/styles/styles.css" />
    </head>
    <body>
        <div id="container">
            <div id="stripe"></div>
            <a href="/" title="<?php echo $s['site_name'] ?>"><div id="header">
            </div></a>
            <div id="menu">
                <ul><li><a href="/gallery">Gallery</a></li><li class="seperator">|</li><li class="current">News</li><li class="seperator">|</li><li><a href="/about">About us</a></li><li class="seperator">|</li><li><a href="/contact">Contact us</a></li></ul>
            </div>
            <div id="content">
                <div id="leftmenu">
                    <ul>
                        <li id="selected"><a>News from <?php echo $s['site_name']; ?></a></li>
                    </ul>
                </div>
                <div id="rightpanel">
                    <h1>News</h1>
                    <?php
                        $n_count=count($n);
                        $i=0;
                        if($n_count==0) echo "<h2>There's no news at the moment.</h2>";
                        while($i<$n_count){
                    ?>
                    <div class="newsItemDiv">
                        <h2><a href="/news/view?nid=<?php echo $n[$i]['news_id']; ?>"><?php echo $n[$i]['caption']; ?></a></h2>
                        <?php echo $n[$i]['abstract']; ?><div class="time">published on <?php echo date('l j F Y', strtotime($n[$i]['create_time'])) ?></div>
                    </div>
                    <?php
                            ++$i;
                        }
                    ?>
                </div>
            </div>
            <div id="stripe"></div>
            <div id="footer">
                &copy; <?php echo $s['site_name'] ?> All rights reserved.
                <ul><li><a href="/about/terms-conditions">Terms & Conditions</a></li><li>|</li><li><a href="/about">About us</a></li><li>|</li><li><a href="/contact">Contact us</a></li><ul>
            </div>
            <div id="stripe"></div>  
        </div>
    </body>
</html>
